package chapter2;
import java.util.Scanner;

class Person{
	private String name;
	private int age;
	private boolean gender;
	private int id;
	private static int nextId;
	public Person() {
		System.out.println("This is constructor");
		System.out.println(name + "," + age + "," + gender + "," + id);
	}
	public Person(String name,int age,boolean gender) {
		this.name = name;
		this.age = age;
		this.gender = gender;
	}
	@Override
	public String toString() {
		return "Person [name=" + name + ", age=" + age + ", gender=" + gender
				+ ", id=" + id + "]";
	}
	static{
		System.out.println("This is static initializtion block");
	}
	
	{
		id=nextId;
		nextId++;
		System.out.println("This is initializtion block, id is "+this.id);
	}
	
	
}
public class Test02 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String na;
		boolean ge;
		int ag;
		Person[] p = new Person[n];
		for (int i = 0; i < n; i++) {
			na = in.next();
			ag = in.nextInt();
			ge = in.nextBoolean();
			p[i] = new Person(na, ag, ge);
			//p[i].SetId(i);
		}
		for (int i = p.length - 1; i >= 0; i--) {
			System.out.println(p[i]);
		}
		Person p2 = new Person();
		System.out.println(p2);
	}

}
